ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Goose_Barnacle_FamilyGroup Class Reference

A class to describe the Barnacle family group. More...

#include <GooseBarnacle_All.h>

Inheritance diagram for Goose_Barnacle_FamilyGroup:
Goose_Barnacle_Base Goose_Base TAnimal TALMaSSObject

Public Member Functions

 Goose_Barnacle_FamilyGroup (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, int a_groupsize, APoint a_roost)
 Goose_Barnacle_FamilyGroup constructor. More...
 
void Init (Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, int a_groupsize, APoint a_roost)
 Intitialise object. More...
 
void ReInit (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, int a_groupsize, APoint a_roost)
 ReInit for object pool. More...
 
virtual ~Goose_Barnacle_FamilyGroup ()
 Goose_Barnacle_FamilyGroup destructor. More...
 
virtual void Step (void)
 The Goose_Barnacle_FamilyGroup Step. More...
 
virtual void EndStep (void)
 The Goose_Barnacle_FamilyGroup EndStep. More...
 
virtual void KillThis (void)
 The FamilyGroup KillThis must be overridden for families. More...
 
- Public Member Functions inherited from Goose_Barnacle_Base
 Goose_Barnacle_Base (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Goose_Barnacle_Base constructor. More...
 
void Init (Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Intitialise object. More...
 
void ReInit (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 ReInit for object pool. More...
 
virtual ~Goose_Barnacle_Base ()
 Goose_Barnacle_Base destructor. More...
 
- Public Member Functions inherited from Goose_Base
 Goose_Base (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Goose_Base constructor. More...
 
void Init (Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 Intitialise object. More...
 
void ReInit (Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
 ReInit for object pool. More...
 
virtual ~Goose_Base ()
 Goose_Base destructor. More...
 
void st_Dying (void)
 Behavioural state dying. More...
 
void Explore ()
 Behavioural exploration of the area to find forage. More...
 
TTypeOfGoose_BaseState st_Forage ()
 Behavioural forage. More...
 
APoint GetRoost ()
 Supply roost coords. More...
 
TMaxIntakeSource GetMaxIntakeSource ()
 Supply the current max intake source. More...
 
TTypeOfGoose_BaseState st_Roost ()
 Roosting until next forage or next morning. More...
 
void EvaluateForageToHopLoc (APoint a_HopLoc)
 Do a forage evaluation from current location to a_HopLoc. More...
 
virtual void StartDay (void)
 Do any 'housekeeping' associated with the start of day. More...
 
virtual void BeginStep (void)
 The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep (10 minutes). More...
 
virtual void On_Emigrate ()
 Cause the bird to immediately transition to Emigrate. More...
 
double GetBodyCondition ()
 Returns the current body condition. More...
 
void SetBodyCondition (double a_condition, unsigned a_index)
 Sets the current body condition. More...
 
void AddBodyCondition (double a_condition)
 Alters body conditon by addition of a double value. More...
 
void SubtractBodyCondition (double a_condition)
 Alters body conditon by subtraction of a double value. More...
 
int GetGroupsize ()
 Returns the groupsize. More...
 
double ScaleForageToGroupsize (double a_forage)
 Scales forage to groupsize. More...
 
int GetForageLocIndex ()
 Gets for the forage location index. More...
 
GooseSpecies GetSpecies ()
 Returns the species. More...
 
bool GetSex ()
 Returns the sex. More...
 
int GetMaxAppetiteHitTime ()
 Returns m_DailyMaxAppetiteHitTime. More...
 
int GetFlightNumber ()
 Returns the total daily number of flights. More...
 
int GetFlightDistance ()
 Returns the total daily distance flown. More...
 
double GetDailyEnergyBudget ()
 Returns the daily energy budget. More...
 
double GetDailyEnergyExpenditure ()
 Returns the daily energy expenditure. More...
 
int GetForagingTime (int a_EndForagingTime, double a_RoostLeaveTime)
 Returns the time spent foraging. More...
 
double GetGooseMinForageRate (GooseSpecies a_species)
 Returns the minimum forage rate for the species. More...
 
double GetMaxForageRate (double a_grain, double a_maize, double a_grass, double a_interferenceComp, bool a_iscereal, TTypesOfVegetation a_veg, bool a_stubble, TTypesOfVegetation a_prevcrop)
 Returns the max forage rate of the three different types of forage The max rate is adjusted according to feeding time in the time budget, according to the interference competition value and to the current snow depth in the landscape. More...
 
double GetMaxIntakeRate (double a_grain, double a_maize, double a_grass)
 Returns the max intake rate of the three different types of intake. More...
 
void SetSex (bool a_sex)
 Sets the sex. More...
 
double GetTotalWeight ()
 Returns the weight of the bird. More...
 
double GetRoostLeaveTime ()
 Returns the time when the goose leaves the roost. More...
 
void SetFlightCost (double a_cost)
 Set the flight cost per m per g. More...
 
double GetFlightCost ()
 Get the flight costs per m per g. More...
 
void Set_mingooseforagerate (double a_cost, GooseSpecies a_species)
 Set the mimimum tolerated forage rate for all geese. More...
 
void Set_Indivmingooseforagerate (double a_cost)
 Set the mimimum tolerated forage rate for the individual goose. More...
 
void Set_GooseLeavingThreshold (double a_threshold)
 Set the body condition threshold for leaving for all geese. More...
 
void Set_GooseMaxAppetiteScaler (double a_cost)
 Set the goose appetite scale used to calculate max intake for all geese. More...
 
void Set_GooseMaxEnergyReserveProportion (double a_prop)
 Set the maximum energy reserve proportion allowed for all geese. More...
 
void Set_GooseKJtoFatConversion (double a_cost)
 Set the kJ to fat conversion constant for all geese. More...
 
void Set_GooseFattoKJConversion (double a_cost)
 Set the fat to kJ conversion constant for all geese. More...
 
void Set_GooseMinForageOpenness (double a_cost)
 Set the min forage openess for all geese. More...
 
void Set_GooseForageDist (double sp1, double sp2, double sp3)
 Set the max forage distance from roost for all geese. More...
 
void Set_GooseFieldForageDist (double sp1, double sp2, double sp3)
 Set the max forage distance from a field for all geese. More...
 
void Set_GooseFollowingLikelyhood (int a_likelyhood, GooseSpeciesType a_speciestype)
 Set the followinglikelyhood. More...
 
void Set_GooseLeavingRoost (bool a_leaving)
 Set the flag to indicate if we are coming from the roost. More...
 
void On_MoveTo (int a_x, int a_y)
 The goose is moved to the location specified by a_x, a_y - caused by group decision. More...
 
void On_Bang (int a_polyid)
 The goose is scared by a bang at location. More...
 
void On_Bang (int a_polyid, double a_scare)
 The goose is scared by a bang at location. More...
 
void On_Migrate (TTypeOfLeaveReason a_leavereason)
 The goose is told to leave the simulation area (poss due to bad weather) More...
 
double AdjustIntakeRateToSnowDepth (double a_intakerate)
 When there is snow, the intake rate is decreased by 10 % per cm of snow. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Goose_Barnacle_Base
TTypeOfGoose_BaseState st_ToRoost ()
 Return to roost and assess whether to forage again that day. More...
 
virtual void ChangeRoost ()
 Find the closest roost. More...
 
virtual APoint ChooseHopLoc ()
 Pick a hop location point within a_dist meters - must be overridden by descendent classes. More...
 
- Protected Member Functions inherited from Goose_Base
TTypeOfGoose_BaseState st_ChooseForageLocation (void)
 Selects a forage location based on past memory, or initiates an exploration. More...
 
void FlyTo (int a_x, int a_y)
 The goose flys to the location specified by a_x, a_y. More...
 
void FlyTo (APoint a_pt)
 The goose flys to the location specified by a_pt. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 
- Protected Attributes inherited from Goose_Base
TTypeOfGoose_BaseState CurrentGState
 Variable to record current behavioural state. More...
 
Goose_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 
bool m_sex
 Sex of bird, true = male false = female. More...
 
GooseSpecies m_myspecies
 Holds goose species. More...
 
GooseSpeciesType m_myGooseSpeciesType
 Holds the goose species type. More...
 
APoint m_MyRoost
 The current roost location. More...
 
int m_groupsize
 The size of the group this bird represents. More...
 
double m_weight
 The weight of the bird in gram excluding fat reserve. More...
 
double m_weightTotal
 The weight of the bird in g including fat reserve. More...
 
int m_forageLocCount
 The number of forage locations visited today. More...
 
double m_BMR
 The daily BMR. More...
 
double m_DEB
 The daily energy budget excluding flying (kJ) More...
 
double m_DailyMaxAppetite
 The daily max kJ possible to get as intake. More...
 
int m_DailyMaxAppetiteHitTime
 The time of day when m_DailyMaxAppetite was hit. More...
 
double m_energyToday
 The bird's daily energy account (kJ) More...
 
TMaxIntakeSource m_MaxIntakeSource
 Holds information about the food source which gave max intake rate. More...
 
double m_LeaveRoostTime
 Controls the time when the goose will leave the roost. More...
 
bool m_LeavingRoost
 Flag to indicate that we are coming from the roost. Used to control code for "following". More...
 
double m_energyReserve
 The bird's energy reserves in grams. More...
 
double m_Indivmingooseforagerate
 The minimum tolerable forage rate in kJ/minute for the individual. More...
 
double m_BodyCondition [5]
 A variable describing current body condition over the past 5 days. More...
 
double m_TheBodyCondition
 A variable describing current body condition averaged over 5 days. More...
 
unsigned m_BodyConditionCounter
 A counter for the daily body condition. More...
 
int m_myForageIndex
 Temporary storage for a forage location index - this is a speed optimisation. More...
 
int m_myMemPolyID
 Temporary storage for a memory location polygon id. More...
 
GooseMemoryMapm_MyMemory
 The Goose Memory. More...
 
int m_FlightNumber
 Counter for the number of flights per day. More...
 
int m_FlightDistance
 Storage for the total distance flown per day. More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 
- Static Protected Attributes inherited from Goose_Base
static double m_SnowDepth = 0.0
 The current snow depth. Held here for speed optimization. More...
 
static double m_flightcost = -1
 The cost of flight per g per m in kJ. More...
 
static double m_mingooseforagerate [gs_foobar] = { -1, -1, -1 }
 The minimum tolerable forage rate in kJ/minute for the species. More...
 
static double m_GooseForageDist [gs_foobar] = { -1, -1, -1 }
 The maximum distance travelled from roost to forage sites for each species of goose (m) More...
 
static double m_GooseForageDistX2 [gs_foobar] = { -1, -1, -1 }
 Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this is a speed optimisation. More...
 
static double m_GooseFieldForageDist [gs_foobar] = { -1, -1, -1 }
 The maximum distance travelled from roost to forage sites for each species of goose (m) More...
 
static double m_GooseFieldForageDistX2 [gs_foobar] = { -1, -1, -1 }
 Double the maximum distance travelled from roost to forage sites for each species of goose (m) - this is a speed optimisation. More...
 
static double m_GooseLeavingThreshold = -1
 The trigger for leaving as a 5 day average of body condition. More...
 
static double m_GooseMaxAppetiteScaler = -1
 Scaler to determine the max kJ possible to eat per day based on non-energy reserve weight. More...
 
static double m_GooseMaxEnergyReserveProportion = -1
 Max proportion of weight that can be energy reserve. More...
 
static double m_GooseKJtoFatConversion = -1
 Conversion rate kJ to fat. More...
 
static double m_GooseFattoKJConversion = -1
 Conversion rate fat to kJ. More...
 
static double m_GooseMinForageOpenness = -1
 The minimum openness value a goose will tolerate for forage. More...
 
static int m_followinglikelyhood [(int) gst_foobar] = { -1, -1, -1 , -1, -1, -1 }
 An attribute used to determine the chance of following or exploring when foraging. More...
 

Detailed Description

A class to describe the Barnacle family group.

Constructor & Destructor Documentation

◆ Goose_Barnacle_FamilyGroup()

Goose_Barnacle_FamilyGroup::Goose_Barnacle_FamilyGroup ( Landscape p_L,
Goose_Population_Manager p_NPM,
double  a_weight,
bool  a_sex,
int  a_groupsize,
APoint  a_roost 
)

Goose_Barnacle_FamilyGroup constructor.

149  : Goose_Barnacle_Base(p_L, p_NPM, a_weight, a_sex, a_roost)
150 {
151  Init(p_NPM, a_weight, a_sex, a_groupsize, a_roost);
152 }
Goose_Barnacle_Base(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
Goose_Barnacle_Base constructor.
Definition: GooseBarnacle_All.cpp:68
void Init(Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, int a_groupsize, APoint a_roost)
Intitialise object.
Definition: GooseBarnacle_All.cpp:154

References Init().

◆ ~Goose_Barnacle_FamilyGroup()

Goose_Barnacle_FamilyGroup::~Goose_Barnacle_FamilyGroup ( )
virtual

Goose_Barnacle_FamilyGroup destructor.

171 {
172  ;
173 }

Member Function Documentation

◆ EndStep()

virtual void Goose_Barnacle_FamilyGroup::EndStep ( void  )
inlinevirtual

The Goose_Barnacle_FamilyGroup EndStep.

Reimplemented from Goose_Base.

89 { ; }

◆ Init()

void Goose_Barnacle_FamilyGroup::Init ( Goose_Population_Manager p_NPM,
double  a_weight,
bool  a_sex,
int  a_groupsize,
APoint  a_roost 
)

Intitialise object.

Here we deal with intialisation that is only for barnacle families

155 {
156  Goose_Barnacle_Base::Init(p_NPM, a_weight, a_sex, a_roost);
160  m_groupsize = a_groupsize;
162 }
@ gst_BarnacleFamilyGroup
Definition: Goose_Base.h:62
void Init(Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
Intitialise object.
Definition: GooseBarnacle_All.cpp:72
GooseSpeciesType m_myGooseSpeciesType
Holds the goose species type.
Definition: Goose_Base.h:163
int m_groupsize
The size of the group this bird represents.
Definition: Goose_Base.h:171

References gst_BarnacleFamilyGroup, Goose_Barnacle_Base::Init(), Goose_Base::m_groupsize, and Goose_Base::m_myGooseSpeciesType.

Referenced by Goose_Barnacle_FamilyGroup(), and ReInit().

◆ KillThis()

void Goose_Barnacle_FamilyGroup::KillThis ( void  )
virtual

The FamilyGroup KillThis must be overridden for families.

Kill this for single animal agents is straightforward, but for families it is a single bird that dies. The bird is randomly picked from the family group, and if the family group is empty the group 'dies' In all cases we need to remove the bird from the forage area if any. The birds do not fly away at this point (if there are any left), this happens when the get the On_Bang message.

Reimplemented from Goose_Base.

284 {
291  if (m_myForageIndex != -1)
292  {
294  }
295  if (--m_groupsize < 1)
296  {
297  delete m_MyMemory; // this is reinitisalised in the object pool.
299  }
300 }
GooseMemoryMap * m_MyMemory
The Goose Memory.
Definition: Goose_Base.h:299
int m_myForageIndex
Temporary storage for a forage location index - this is a speed optimisation.
Definition: Goose_Base.h:291
Goose_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Goose_Base.h:151
void RemoveGeeseFromForageLocation(GooseSpeciesType a_type, int a_index, int a_number)
Removes a goose or geese to the forage location - requires an index.
Definition: Goose_Population_Manager.cpp:1812
virtual void KillThis()
Definition: PopulationManager.h:219

References TAnimal::KillThis(), Goose_Base::m_groupsize, Goose_Base::m_myForageIndex, Goose_Base::m_myGooseSpeciesType, Goose_Base::m_MyMemory, Goose_Base::m_OurPopulationManager, and Goose_Population_Manager::RemoveGeeseFromForageLocation().

◆ ReInit()

void Goose_Barnacle_FamilyGroup::ReInit ( Landscape p_L,
Goose_Population_Manager p_NPM,
double  a_weight,
bool  a_sex,
int  a_groupsize,
APoint  a_roost 
)

ReInit for object pool.

166 {
167  Goose_Barnacle_Base::ReInit(p_L, p_NPM, a_weight, a_sex, a_roost);
168  Init(p_NPM, a_weight, a_sex, a_groupsize, a_roost);
169 }
void ReInit(Landscape *p_L, Goose_Population_Manager *p_NPM, double a_weight, bool a_sex, APoint a_roost)
ReInit for object pool.
Definition: GooseBarnacle_All.cpp:86

References Init(), and Goose_Barnacle_Base::ReInit().

Referenced by Goose_Population_Manager::CreateObjects().

◆ Step()

void Goose_Barnacle_FamilyGroup::Step ( void  )
virtual

The Goose_Barnacle_FamilyGroup Step.

In state ChooseForageLocation, if the bird is the group leader then he will determine the forage location. Otherwise does nothing, all thinking is done by the group leader.

In state Forage the bird must assess competitive status, and determine forage intake. If acceptable feed, otherwise move

Reimplemented from Goose_Base.

177 {
178  if (m_StepDone || m_CurrentStateNo == -1) return;
179  switch (CurrentGState)
180  {
181  case togs_InitialState: // Initial state always starts by setting the behaviour to togs_Roost
183  break;
186  m_StepDone = true;
187  break;
188  case togs_Forage:
190  m_StepDone = true;
191  break;
192  case togs_ToRoost:
194  m_StepDone = true;
195  break;
196  case togs_Roost:
198  m_StepDone = true;
199  break;
200  case togs_Emigrate:
202  break;
203  case togs_Die:
204  st_Dying(); // No return value - no behaviour after this
205  m_StepDone=true;
206  break;
207  default:
208  m_OurLandscape->Warn("Goose_Barnacle_FamilyGroup::Step()","unknown state - default");
209  exit(1);
210  }
211 }
@ togs_Roost
Definition: Goose_Base.h:80
@ togs_InitialState
Definition: Goose_Base.h:76
@ togs_ChooseForageLocation
Definition: Goose_Base.h:77
@ togs_Forage
Definition: Goose_Base.h:78
@ togs_ToRoost
Definition: Goose_Base.h:79
@ togs_Die
Definition: Goose_Base.h:81
@ togs_Emigrate
Definition: Goose_Base.h:82
@ tolr_migration
Definition: Goose_Base.h:104
TTypeOfGoose_BaseState st_ToRoost()
Return to roost and assess whether to forage again that day.
Definition: GooseBarnacle_All.cpp:98
TTypeOfGoose_BaseState st_ChooseForageLocation(void)
Selects a forage location based on past memory, or initiates an exploration.
Definition: Goose_Base.cpp:258
TTypeOfGoose_BaseState CurrentGState
Variable to record current behavioural state.
Definition: Goose_Base.h:147
void On_Migrate(TTypeOfLeaveReason a_leavereason)
The goose is told to leave the simulation area (poss due to bad weather)
Definition: Goose_Base.cpp:722
void st_Dying(void)
Behavioural state dying.
Definition: Goose_Base.cpp:251
TTypeOfGoose_BaseState st_Forage()
Behavioural forage.
Definition: Goose_Base.cpp:433
TTypeOfGoose_BaseState st_Roost()
Roosting until next forage or next morning.
Definition: Goose_Base.cpp:550
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
Landscape * m_OurLandscape
Definition: PopulationManager.h:229

References Goose_Base::CurrentGState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, Goose_Base::On_Migrate(), Goose_Base::st_ChooseForageLocation(), Goose_Base::st_Dying(), Goose_Base::st_Forage(), Goose_Base::st_Roost(), Goose_Barnacle_Base::st_ToRoost(), togs_ChooseForageLocation, togs_Die, togs_Emigrate, togs_Forage, togs_InitialState, togs_Roost, togs_ToRoost, tolr_migration, and Landscape::Warn().


The documentation for this class was generated from the following files: